package com.lbb.shard.jdbc.demo.mapper;

import com.lbb.shard.jdbc.demo.pojo.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper {
    @Select("SELECT * FROM t_order WHERE order_id = #{orderId}")
    List<Order> findByUserId(Integer orderId);

    @Insert("INSERT INTO t_order (order_id,user_id,create_time,total_price) values (#{order.orderId},#{order.userId},#{order.createTime},#{order.totalPrice})")
    void saveOder(@Param("order") Order order);
}
